#pragma once

#include "singleton_container.h"

template<class T, class MockT>
class SingletonMocker {
public:
    SingletonMocker()
    {
        origin = SingletonContainer::Get<T>();
        mock = new MockT();
        SingletonContainer::Set<T>(mock.GetRefPtr());
    }

    ~SingletonMocker()
    {
        SingletonContainer::Set<T>(origin);
    }

    sptr<T> Origin()
    {
        return origin;
    }

    sptr<MockT> Mock()
    {
        return mock;
    }

private:
    sptr<T> origin = nullptr;
    sptr<MockT> mock = nullptr;
};
